package com.zahb.qadx.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by Zdw on 2020/11/03 13:56
 */
public class Question implements Parcelable, Comparable<Question> {

    private int id;
    private int rootOrgId;
    private int questionType;// 1单选  2多选  3判断  4填空  5简答
    private int difficultyLevel;
    private String content;
    private String parsing;
    private int parentId;
    private int practiceQuestionsId;
    private int questionRelationId;
    private List<QuestionOption> questionOptionList;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRootOrgId() {
        return rootOrgId;
    }

    public void setRootOrgId(int rootOrgId) {
        this.rootOrgId = rootOrgId;
    }

    public int getQuestionType() {
        return questionType;
    }

    public void setQuestionType(int questionType) {
        this.questionType = questionType;
    }

    public int getDifficultyLevel() {
        return difficultyLevel;
    }

    public void setDifficultyLevel(int difficultyLevel) {
        this.difficultyLevel = difficultyLevel;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getParsing() {
        return parsing;
    }

    public void setParsing(String parsing) {
        this.parsing = parsing;
    }

    public int getParentId() {
        return parentId;
    }

    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    public int getPracticeQuestionsId() {
        return practiceQuestionsId;
    }

    public void setPracticeQuestionsId(int practiceQuestionsId) {
        this.practiceQuestionsId = practiceQuestionsId;
    }

    public int getQuestionRelationId() {
        return questionRelationId;
    }

    public void setQuestionRelationId(int questionRelationId) {
        this.questionRelationId = questionRelationId;
    }

    public List<QuestionOption> getQuestionOptionList() {
        return questionOptionList;
    }

    public void setQuestionOptionList(List<QuestionOption> questionOptionList) {
        this.questionOptionList = questionOptionList;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeInt(this.rootOrgId);
        dest.writeInt(this.questionType);
        dest.writeInt(this.difficultyLevel);
        dest.writeString(this.content);
        dest.writeString(this.parsing);
        dest.writeInt(this.parentId);
        dest.writeInt(this.practiceQuestionsId);
        dest.writeInt(this.questionRelationId);
        dest.writeTypedList(this.questionOptionList);
    }

    public Question() {
    }

    protected Question(Parcel in) {
        this.id = in.readInt();
        this.rootOrgId = in.readInt();
        this.questionType = in.readInt();
        this.difficultyLevel = in.readInt();
        this.content = in.readString();
        this.parsing = in.readString();
        this.parentId = in.readInt();
        this.practiceQuestionsId = in.readInt();
        this.questionRelationId = in.readInt();
        this.questionOptionList = in.createTypedArrayList(QuestionOption.CREATOR);
    }

    public static final Creator<Question> CREATOR = new Creator<Question>() {
        @Override
        public Question createFromParcel(Parcel source) {
            return new Question(source);
        }

        @Override
        public Question[] newArray(int size) {
            return new Question[size];
        }
    };

    @Override
    public int compareTo(Question o) {
        return getQuestionType() - o.getQuestionType();
    }
}
